<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "user_signin".
 *
 * @property int $id
 * @property string $user_id 用户id
 * @property string $signin_time 开始签约时间
 * @property string $expired_time 到期时间
 * @property int $is_apply 是否试用,1试用,0不是试用
 * @property int $status 状态
 *
 * @property UserSigninPay[] $userSigninPays
 */
class UserSignin extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'user_signin';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_id', 'signin_time', 'expired_time'], 'required'],
            [['user_id'], 'integer'],
            [['signin_time', 'expired_time'], 'safe'],
            [['is_apply', 'status'], 'string', 'max' => 5],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'user_id' => '用户id',
            'signin_time' => '开始签约时间',
            'expired_time' => '到期时间',
            'is_apply' => '是否试用,1试用,0不是试用',
            'status' => '状态',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUserSigninPays()
    {
        return $this->hasMany(UserSigninPay::className(), ['signin_id' => 'id']);
    }
}
